base.test.js ➔ ???   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
nc 1
nop 0
dl 0
loc 6
c 5
b 0
f 0
cc 1
rs 9.4285
1
"use strict";
2
const Base = require("../src/types/base");
3
4
test("test instantiation of Base", () => {
5
    const string = new Base();
6
7
    expect(string).toBeInstanceOf(Base);
8
    //expect(string.type).toBe("base");
9
});
10
11
test("test required()", () => {
12
    const string = new Base();
13
14
    expect(string.required()).toBe(string);
15
    expect(string.isRequired).toBeTruthy();
16
});
17
18
test("test min()", () => {
19
    const string = new Base();
20
21
    expect(string.min(5)).toBe(string);
22
    expect(string.minValue).toBe(5);
23
});
24
25
test("test max()", () => {
26
    const string = new Base();
27
28
    expect(string.max(10)).toBe(string);
29
    expect(string.maxValue).toBe(10);
30
});
31
32
test("test error()", () => {
33
    const string = new Base();
34
35
    expect(string.error("Any:required", "test")).toEqual({ error: {
36
        type: "Any:required",
37
        field: "test",
38
        message: "'test' is required and can't be omitted."
39
    }});
40
});
41